package br.com.opengti.webforum.mb;

import java.util.logging.Logger;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;

import br.com.opengti.webforum.vo.TopicoVO;

@ManagedBean(name = "topicoBean")
@SessionScoped
public class TopicoBean {
	
	Logger logger = Logger.getLogger(TopicoBean.class.getName());
	
	private TopicoVO topicoVO;

	public void save(){
		
		 Client client = Client.create();
		 WebResource webResource = client.resource("http://localhost:8080/openforum/ws/topico/list");
		 
		TopicoVO resultado = webResource.get(TopicoVO.class);
		 
		 
		 
		 FacesContext.getCurrentInstance().addMessage("teste", new FacesMessage(resultado.getMensagem() + " OK"));

		
	}
	
	
	/*
	 * Gets and Sets
	 */
	
	public TopicoVO getTopicoVO() {
		return topicoVO;
	}

	public void setTopicoVO(TopicoVO topicoVO) {
		this.topicoVO = topicoVO;
	}

}
